#include<vector>
#include<string>
using namespace std;

class Solution {
public:
    vector<string> summaryRanges(vector<int>& nums) {
        vector<string> res;
        int start = 0;
        for (int end = start+1; end <= nums.size(); ++end) {
            if(end!= nums.size()&& nums[end]-1==nums[end - 1])
                continue;
            string tmp = to_string(nums[end - 1]);
            if (start!=end-1) {
                tmp = to_string(nums[start]) +"->"+tmp;
            }
            res.push_back(tmp);
            start = end;
        }
        return res;
    }
};